is-function-x
Determine whether a given value is a function object.
module.exports(value, [allowClass])
⇒ boolean
⏏
Checks if value
is classified as a Function
object.
Kind: Exported function
Returns: boolean
- Returns true
if value
is correctly classified,
else false
.
Param | Type | Default | Description |
---|
value | * | | The value to check. |
[allowClass] | boolean | false | Whether to filter ES6 classes. |
Example
import isFunction from 'is-function-x';
console.log(isFunction());
console.log(isFunction(Number.MIN_VALUE));
console.log(isFunction('abc'));
console.log(isFunction(true));
console.log(isFunction({name: 'abc'}));
console.log(isFunction(function() {}));
console.log(isFunction(new Function()));
console.log(isFunction(function* test1() {}));
console.log(isFunction(function test2(a, b) {}));
console.log(isFunction(async function test3() {}));
console.log(isFunction(class Test {}));
console.log(isFunction(class Test {}, true));
console.log(
isFunction((x, y) => {
return this;
}),
);